import Home from '@/pages/home'
import ErrorPage from '@/pages/public/errorPage'

//用户
import UserList from '@/pages/sysMan/user/list'
//角色权限
import AuthList from '@/pages/sysMan/auth/list'


//文件管理
import FileManagerList from '@/pages/fileManager/list'
import FileDetailEdit from '@/pages/fileManager/edit'

//数据管理
import DataManagerList from '@/pages/dataManager/list'



//指标管理
//指标定义
import TargetManager from '@/pages/targetManager/list'
//指标数据
import TargetData from '@/pages/targetManager/data'

//角色列表
import RoleList from '@/pages/sysMan/role/list'
//菜单列表
import MenuList from '@/pages/menus/list'
//公司设置
import SysCompSet from '@/pages/sysMan/comp'
//修改权限测试页面
import AuthTest from '@/pages/test'

//字典
import Dictionary from '@/pages/sysMan/dictionary'

//
import CommonList from '@/pages/commonList/index'

//基础信息
//管理关系
import BasicManRelation from '@/pages/basicinfo/manRelation'

// 指标类
import ClassContainer from '@/pages/basicinfo/class'

//区域
import BasicAdminregions from '@/pages/basicinfo/adminregions'
import WebviewPage from '@/pages/webview/index'
import BIPAGE from '@/pages/biView/index'

// import DataBase from '@/pages/db/database';
// import Monitor from '@/pages/db/monitor';
// import Redis from '@/pages/db/redis';
// import Tasks from '@/pages/db/task';
// import Transfer from '@/pages/db/transfer';
import Transfer from '@/pages/db/transfer'
import CatchCom from '@/pages/db/catch'
import LoadCom from '@/pages/db/load'
import monitor from '@/pages/db/monitor'
import Source from '@/pages/db/source'
import Db from '@/pages/db/db'

import Intetface from '@/pages/interface/intetface';



import CleanRole from '@/pages/cleanFusion/cleanRole'
import DataIntegration from '@/pages/cleanFusion/dataIntegration'
import DataTemplate from '@/pages/cleanFusion/dataTemplate'

/**
 * path 跳转的路径
 * component 对应路径显示的组件
 * exact 匹配规则，true的时候则精确匹配。
 */
const menus = [
  {
    path: '/admin/',
    name: '首页',
    exact: true,
    key: 'home',
    component: Home
  },
  {
    path: '/admin/cleanFusion',
    name: '清洗融合',
    exact: true,
    key: 'cleanFusion',
    type: 'subMenu',
    routes:[
      {
        path: '/admin/cleanFusion/cleanRole',
        name: '清洗规则管理',
        key: 'cleanfusion:cleanrole:view',
        component: CleanRole
      },
      {
        path: '/admin/cleanFusion/dataIntegration',
        name: '数据集成管理',
        key: 'cleanfusion:dataintegration:view',
        component: DataIntegration
      },
      {
        path: '/admin/cleanFusion/dataTemplate',
        name: '调度任务',
        key: 'cleanfusion:datatemplate:view',
        component: DataTemplate
      },
    ]
  },
  {
    path: '/admin/db',
    name: '数据库工具',
    exact: true,
    key: 'db',
    type: 'subMenu',
    routes:[
      {
        path: '/admin/db/datasource',
        name: '数据源',
        key: 'db:datasource:view',
        component: Source
      },
      {
        path: '/admin/db/db',
        name: '查询',
        key: 'db:db:view',
        component: Db
      },
      
      {
        path: '/admin/db/transfer',
        name: '传输任务',
        key: 'db:transfer:view',
        component: Transfer
      },
      {
        path: '/admin/db/catch',
        name: '捕获任务',
        key: 'db:catch:view',
        component: CatchCom
      },

       {
        path: '/admin/db/load',
        name: '加载任务',
        key: 'db:load:view',
        component: LoadCom
      },
      {
        path: '/admin/db/monitor',
        name: '监控',
        key: 'db:monitor:view',
        component: monitor
      },
      // {
      //   path: '/admin/db/transfer',
      //   name: '接口列表',
      //   key: 'db:transfer',
      //   component: Transfer
      // },
      // {
      //   path: '/admin/db/interface',
      //   name: '接口列表',
      //   key: 'db:interface',
      //   component: Transfer
      // },
    ],
  },
  {
    path: '/admin/bi',
    name: 'BI报表',
    exact: true,
    key: 'bi',
    type: 'subMenu',
    routes: [
      {
        path: '/admin/bi/my',
        name: '煤业系统报表',
        key: 'my:list:view',
        component: BIPAGE
      },
      {
        path: '/admin/bi/jh',
        name: '焦化系统报表',
        key: 'jh:list:view',
        component: BIPAGE
      },
      {
        path: '/admin/bi/gx',
        name: '供销系统报表',
        key: 'gx:list:view',
        component: BIPAGE
      },
      {
        path: '/admin/bi/cb',
        name: '焦化系统成本报表',
        key: 'cb:list:view',
        component: BIPAGE
      },
    ]
  },
  {
    path: '/admin/targetMan',
    name: '指标管理',
    exact: true,
    key: 'targetMan',
    routes: [
      {
        path: '/admin/targetMan/list',
        name: '指标定义',
        key: 'targetMan:list:view',
        component: TargetManager
      },
    ]
  },
  {
    path: '/admin/basicinfo',
    name: '基础信息',
    key: 'basicinfo',
    type: 'subMenu',
    exact: true,
    routes: [
      {
        path: '/admin/basicinfo/manRelation',
        name: '管理关系',
        key: 'basicinfo:manRelation',
        component: BasicManRelation
      },
      {
        path: '/admin/basicinfo/class',
        name: '指标类',
        key: 'basicinfo:class',
        component: ClassContainer
      }
    ]
  },
  {
    path: '/admin/intetface',
    name: '接口管理',
    exact: true,
    key: 'intetface',
    routes: [
      {
        path: '/admin/intetface/list',
        name: '接口管理',
        key: 'intetface:list:view',
        component: Intetface,
      },
    ]
  },
  {
    path: '/admin/data/gov',
    name: '数据治理',
    exact: true,
    key: 'data:gov',
    routes: [
      {
        path: '/admin/data/gov/sdx',
        name: 'SDX',
        key: 'data:gov:sdx',
        externalLink:'http://localhost:8099/#/admin/bi/my?iframe=true',
        component: WebviewPage,
      },
      {
        path: '/admin/data/gov/sadp',
        name: 'SADP',
        key: 'data:gov:sadp',
        externalLink:'http://localhost:8099/#/admin/targetMan/list?iframe=true',
        component: WebviewPage,
      }
    ]
  },
  {
    path: '/admin/sys',
    name: '系统管理',
    exact: true,
    key: 'sys',
    routes: [
      {
        path: '/admin/sys/user',
        name: '用户管理',
        key: 'user:list:view',
        component: UserList,
      },
      {
        path: '/admin/sys/role',
        name: '角色列表',
        key: 'role:list:view',
        component: RoleList
      },
      {
        path: '/admin/sys/auth',
        name: '权限管理',
        key: 'auth:list:view',
        component: AuthList,
      },
      {
        path: '/admin/sys/dirMan?type=5',
        name: '字典管理',
        key: 'dir:list:view',
        component: Dictionary,
      },
      {
        path: '/admin/sys/menu',
        name: '菜单管理',
        key: 'menu:list:view',
        component: MenuList
      },
      {
        path: '/admin/sys/comp',
        name: '系统参数',
        key: 'sys:comp:set',
        component: SysCompSet
      },
    ],
  },

  {
    path: '/admin/dataTool',
    name: '数据工具',
    key: 'dataTool',
    exact: true,
    type: 'subMenu',
    routes: [
      {
        path: '/admin/dataTool/finebi',
        name: '帆软BI报表',
        key: 'dataTool:finebi',
        component: FileManagerList,
        externalLink:'http://192.168.200.95:12345/dolphinscheduler'
      },
      {
        path: '/admin/dataTool/etl',
        name: 'ETL调度工具',
        key: 'dataTool:etl',
        component: FileManagerList,
        externalLink:'http://192.168.200.95:12345/dolphinscheduler'
      },
      {
        path: '/admin/dataTool/mmp',
        name: 'MPP集群监控',
        key: 'dataTool:mmp',
        component: FileManagerList,
        externalLink:'http://192.168.200.95:3000'
      },
      {
        path: '/admin/dataTool/dbweb',
        name: '数据库WEB管理工具',
        key: 'dataTool:mmp',
        component: FileManagerList,
        externalLink:'http://192.168.200.95:3000/login'
      }
    ],
  },
  {
    path: '/admin/auth',
    name: '权限测试页',
    exact: true,
    key: 'auth:test:view',
    component: AuthTest
  },
  {
    path: '/admin/403',
    name: '暂无权限',
    exact: true,
    key: '/403',
    component: ErrorPage
  }
]



const menusarr = {};
const run = (data)=>{
  data.map((e,i)=>{
    menusarr[e['key']] = e['component'];
    if(e.routes){
      run(e.routes);
    }
  })
  
}

run(menus)


console.log('menus');


console.log(menusarr);
export default menus

export {
  menusarr
}
